﻿using TemplatesPrint.DBHelper;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TemplatesPrint.Entitys
{
    [SugarTable("ClientInfos")]
    public class ClientInfoEntity : BaseEntity
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        [SugarColumn(IsNullable = true)]
        public string Info { get; set; }

        [Navigate(NavigateType.OneToMany, nameof(TaskInfoEntity.Source), nameof(Info))]
        public List<TaskInfoEntity> Tasks { get; set; }
        [SugarColumn(IsIgnore = true, ColumnDescription = "对应的任务数量")]
        public int TaskNum { get { return Tasks.Count(); } }

        [SugarColumn(IsNullable = true, ColumnDescription = "连接状态，0-正常，1-断开")]
        public string Status { get; set; }

        [SugarColumn(IsNullable = true, ColumnDescription = "是否允许打印，0-不允许，1-允许")]
        public string IsPrint { get; set; }

        [SugarColumn(IsNullable = true,  ColumnDescription = "是否允许接收，0-不允许，1-允许")]
        public string IsReceive { get; set; }
    }
}
